class StringFormat {
public:
    string formatString(string A, int n, vector<char> arg, int m) {
        string ret;
        int cnt = 0;
        for (auto ch : A)if (ch == '%')cnt++;

        int i = 0, j = 0;
        for (; i < n; i++)
        {
            if (A[i] != '%')
            {
                ret += A[i];
            }
            else
            {
                ret += arg[j++];
                i++;
                cnt--;
            }
        }
        while (j < arg.size())
        {
            ret += arg[j++];
        }
        return ret;
    }
};